#include "UnitTypes.h"
#include "../phy/Phycccp.h"


TechTank::TechTank()
{
	this->mHP = 10;
	mMuzzleEffect = "Putin/TankMuzzleFire";
}

// --- LEO Main battle Tank ---
Leo::Leo(Vec3f pos, Vec3f facing, Player* p)
{
	this->mPlayer = p;
	this->mPos = pos;
	this->mFacingDirection = facing;
	this->mUpVector = Vec3f(0.0f,0.0f,1.0f);
	this->mMesh = "TankBase.mesh";
	this->mMaterial = "Putin/tank";
	this->mChildMaterial = "Putin/tank";
	this->mChildMesh = "TankTower.mesh";
	this->mShootingRange = 150.0f;
	this->mShootingCooldown = 2.0f;

	// Test:
	this->mChildFacingDirection = Vec3f(0.0f,0.0f,1.0f);		


	this->mScale = 10.0f;
	this->mShadow = true;
	this->mMaxSpeed = 42.0f;

	// Set physics attrib
	this->mConstants->fov = 0.5f;
	this->mConstants->turningSpeed = 0.8f;
	this->mConstants->tracktion = 0.80f;
	this->mConstants->maxSpeed = this->mMaxSpeed;
	this->mConstants->turningSmoothener = M_PI / 16.0f;
	this->mConstants->acceleration = 1.0f;
	this->mConstants->weight = 1.0f;
	this->mConstants->maxTorque = mConstants->maxSpeed * mConstants->tracktion;
	//this->moveTo(Vec3f(1024.0f, 1024.0f, 40.0f));
	this->mConstants->accelerationType = true;
}

TechBullet* Leo::createBullet()
{
	return new RegularBullet(getPosition(),getShootingTarget(),getID());
}


// -- ARCHER: Armoured Tank Artillery --
Archer::Archer(Vec3f pos, Vec3f facing, Player* p)
{
	this->mPlayer = p;
	this->mPos = pos;
	this->mFacingDirection = facing;
	this->mUpVector = Vec3f(0.0f,0.0f,1.0f);
	this->mMesh = "TankBase.mesh";
	this->mMaterial = "Putin/tank";
	this->mChildMaterial = "Putin/tank";
	this->mChildMesh = "ArtTower.mesh";
	this->mMuzzleEffect = "Putin/ArcherMuzzleFire";
	this->mShootingRange = 150.0f;
	this->mShootingCooldown = 2.0f;

	// Test:
	this->mChildFacingDirection = Vec3f(0.0f,0.0f,0.0f);		


	this->mScale = 10.0f;
	this->mShadow = true;
	this->mMaxSpeed = 32.0f;

	// Set physics attrib
	this->mConstants->fov = 0.5f;
	this->mConstants->turningSpeed = 0.8f;
	this->mConstants->tracktion = 0.95f;
	this->mConstants->maxSpeed = this->mMaxSpeed;
	this->mConstants->turningSmoothener = M_PI / 16.0f;
	this->mConstants->acceleration = 1.0f;
	this->mConstants->weight = 1.0f;
	this->mConstants->maxTorque = mConstants->maxSpeed * mConstants->tracktion;
	//this->moveTo(Vec3f(1024.0f, 1024.0f, 40.0f));
	this->mConstants->accelerationType = true;
}

TechBullet* Archer::createBullet()
{
	return new GranadeBullet(getPosition(),getShootingTarget(),getID());
}

Truck::Truck(Vec3f pos, Vec3f facing, Player* p)
{
	this->mPlayer = p;
	this->mPos = pos;
	this->mFacingDirection = facing;
	this->mUpVector = Vec3f(0.0f,0.0f,1.0f);
	this->mMesh = "TruckBase.mesh";
	this->mMaterial = "Putin/TruckBase";
	this->mChildMaterial = "Putin/TruckAutocannon";
	this->mChildMesh = "TruckAutocannon.mesh";
	this->mShootingRange = 75.0f;
	this->mShootingCooldown = 1.0f;

	// Test:
	this->mChildFacingDirection = Vec3f(0.0f,0.0f,0.0f);		


	this->mScale = 1.5f;
	this->mShadow = true;
	this->mHP = 5;
	this->mMaxSpeed = 60.0f;

	// Set physics attrib
	this->mConstants->fov = 0.5f;
	this->mConstants->turningSpeed = 0.8f;
	this->mConstants->tracktion = 0.7f;
	this->mConstants->maxSpeed = this->mMaxSpeed;
	this->mConstants->turningSmoothener = M_PI / 16.0f;
	this->mConstants->acceleration = 0.5f;
	this->mConstants->weight = 0.5f;
	this->mConstants->maxTorque = mConstants->maxSpeed * mConstants->tracktion;
	//this->moveTo(Vec3f(1024.0f, 1024.0f, 40.0f));
	this->mConstants->accelerationType = true;
}


TechBullet* Truck::createBullet()
{
	return new SmallBullet(getPosition(),getShootingTarget(),getID());
}



RedLeo::RedLeo(Vec3f pos, Vec3f facing, Player* p)
: Leo(pos,facing,p)
{
	this->mMaterial = "Putin/tank2";
	this->mChildMaterial = "Putin/tank2";
}

RedTruck::RedTruck(Vec3f pos, Vec3f facing, Player* p)
: Truck(pos,facing,p)
{
	this->mMaterial = "Putin/tank2";
	this->mChildMaterial = "Putin/tank2";
}

RedArcher::RedArcher(Vec3f pos, Vec3f facing, Player* p)
: Archer(pos,facing,p)
{
	this->mMaterial = "Putin/tank2";
	this->mChildMaterial = "Putin/tank2";
}

// ===== GAME OBJECTS not for play. but for looking at.. kinda... =====

Stone::Stone(Vec3f pos, Vec3f facing)
{
	this->mPos = pos;
	this->mFacingDirection = facing;
	this->mUpVector = Vec3f(0.0f,0.0f,1.0f);
	this->mMesh = "crussianstone.mesh";
	this->mMaterial = "Putin/stone";
	this->mScale = 6.0f;
	this->mShadow = true;
}

// ------ BULLETS -------

GranadeBullet::GranadeBullet(Vec3f pos, Vec3f target, int owner)
{
	this->mPos = pos;
	this->mFacingDirection = pos - pos;
	this->mUpVector = Vec3f(0.0f,0.0f,1.0f);
	this->mMesh = "bullet.mesh";
	this->mMaterial = "Putin/Bullet";
	this->mScale = 1.5f;
	this->mShadow = true;

	mDamage = 3;

	this->mTargetLoc = target;
	this->mOwner= owner;
	mProjectileObjectConstants->gravity = 9.82f;
	mProjectileObjectConstants->initialAngle = 3.141f/4.0f;
	mProjectileObjectConstants->speed = 0.3f;
	mProjectileObjectConstants->splashRange = 7.0f;
}


RegularBullet::RegularBullet(Vec3f pos, Vec3f target, int owner)
{
	this->mPos = pos;
	this->mFacingDirection = pos - pos;
	this->mUpVector = Vec3f(0.0f,0.0f,1.0f);
	this->mMesh = "bullet.mesh";
	this->mMaterial = "Putin/Bullet";
	this->mScale = 1.0f;
	this->mShadow = true;

	mDamage = 2;

	this->mTargetLoc = target;
	this->mOwner= owner;
	mProjectileObjectConstants->gravity = 9.82f;
	mProjectileObjectConstants->initialAngle = 3.141f/4.0f;
	mProjectileObjectConstants->speed = 0.3f;
	mProjectileObjectConstants->splashRange = 5.0f;
}


SmallBullet::SmallBullet(Vec3f pos, Vec3f target, int owner)
{
	this->mPos = pos;
	this->mFacingDirection = pos - pos;
	this->mUpVector = Vec3f(0.0f,0.0f,1.0f);
	this->mMesh = "bullet.mesh";
	this->mMaterial = "Putin/Bullet";
	this->mScale = 0.5f;
	this->mShadow = true;

	this->mDamage = 1; // from tech bullet

	this->mTargetLoc = target;
	this->mOwner= owner;
	mProjectileObjectConstants->gravity = 9.82f;
	mProjectileObjectConstants->initialAngle = 3.141f/4.0f;
	mProjectileObjectConstants->speed = 0.3f;
	mProjectileObjectConstants->splashRange = 2.0f;
}
